Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate arguments.callee #18384

Merged
merged 1 commit into from
Dec 7, 2022
Merged

Deprecate arguments.callee #18384

merged 1 commit into from
Dec 7, 2022

Conversation

Josh-Cena
Copy link
Member

Summary

This thing is not available in strict mode, so it should be deprecated like with statements. It's already noted in the JS deprecated features page.

Test results and supporting details

Related issues

@github-actions github-actions bot added the data:js 📟 Compat data for JS/ECMAScript features. https://developer.mozilla.org/docs/Web/JavaScript label Dec 7, 2022
@Elchi3
Copy link
Member

Elchi3 commented Dec 7, 2022

Is this really deprecated per the guidelines? https://github.com/mdn/browser-compat-data/blob/main/docs/data-guidelines/index.md#setting-deprecated I can't find authoritative text suggesting so.

If it is, then I guess we want an accompanying content PR?
I know @OnkarRuikar syncs experimental/deprecated/non-standard statuses between BCD and content. I believe that sync would mean that https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments/callee gets a deprecated header and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments#properties would get an inline deprecated badge.

@OnkarRuikar
Copy link
Contributor

OnkarRuikar commented Dec 7, 2022

then I guess we want an accompanying content PR?

I suggest not to manually create a PR for this in mdn/content repo. There will be a sync PR for the BCD release, containing these changes.

The BCD - mdn/content synchronization is automated(at the moment going trough same phases as markdownlint automation did). We want to make mdn/browser-compat-data the single source of truth.


The latest specs (2023) still defines the property on arguments object:

  1. Perform ! DefinePropertyOrThrow(obj, "callee", PropertyDescriptor { [[Get]]: %ThrowTypeError%, [[Set]]: %ThrowTypeError%, [[Enumerable]]: false, [[Configurable]]: false }).

@Josh-Cena
Copy link
Member Author

Josh-Cena commented Dec 7, 2022

@Elchi3 This is deprecated in the sense that it's forbidden in strict mode. Because ES can never unship APIs, this is closest to "removal from spec" in the ES world.

I'm not sure what content change is necessary, but (1) it's already listed on the deprecated features page (2) accessing callee throws the same error as func.caller, and the word "deprecated" is in the error description. caller is also described as deprecated.

In fact, I do have a content change prepared for the related pages, although it's not totally related to this deprecation, but more for the page types work. The BCD syncing is automatic as Onkar noted, so I think this is all we need.

@OnkarRuikar Your quoted spec is the "throwing" part, which is strictly more "deprecated-like" than not installing the property at all. callee's continued support lives in sloppy mode, which corresponds to the CreateMappedArgumentsObject section below.

@Elchi3
Copy link
Member

Elchi3 commented Dec 7, 2022

I'm double checking here because In case of with, there was a debate and we talked to TC39 to add "discouraged" into the spec text officially. So that, to me, is an authoritative source to call with "deprecated" in our docs.

It would be nice to have a similar authoritative spec text for this case so that the discouragement position is as strong as that for with.

accessing callee throws the same error as func.caller

Thanks! Even though it is not a non-standard feature I guess this could count as a signal for us to mark it in fact deprecated per this guideline rule:

For non-standard features, notice from implementing browsers (for example, a console deprecation warning) or vendor documentation

What do you think?

@Josh-Cena
Copy link
Member Author

If I try hard enough, I can probably find meeting notes from ES5 about how implementers dislike this feature (which is why it's removed from strict mode at all). But sifting through pre-ES6 notes is always a pain, so if you are convinced, we should be good :) After all, developers not being able to use the feature is already a stronger signal than a mere editorial marker of deprecation.

Copy link
Member

@Elchi3 Elchi3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, I'm convinced, let's try this then and see if anyone complains :)

@Elchi3 Elchi3 merged commit 2c889c5 into mdn:main Dec 7, 2022
@Josh-Cena Josh-Cena deleted the deprecate-callee branch December 7, 2022 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:js 📟 Compat data for JS/ECMAScript features. https://developer.mozilla.org/docs/Web/JavaScript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants